from apscheduler.schedulers.background import BackgroundScheduler
from django_apscheduler.jobstores import DjangoJobStore, register_events, register_job
import uuid

import datetime

scheduler = BackgroundScheduler()
scheduler.add_jobstore(DjangoJobStore(), "default")

run_date = datetime.datetime.now() + datetime.timedelta(seconds=20)


@register_job(scheduler, "date", id=uuid.uuid4().hex, run_date=run_date, replace_existing=True,
              timezone='Asia/Shanghai')
def setUp_database_scheduler():
    print("Setting up database scheduler")


register_events(scheduler)
scheduler.start()
